package com.lmf.Test;

import com.lmf.config.SpringConfig;
import com.lmf.service.UserService2;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class TestSpringConfig {
    /**
     * 测试： 配置类 代替 xml配置文件
     */

    @Test
    public void test1(){
        //测试方法，使用AnnotationConfigApplicationContext(配置类.class)方法
        ApplicationContext context=new AnnotationConfigApplicationContext(SpringConfig.class);
        UserService2 userService2 = context.getBean("userService2", UserService2.class);
        userService2.show();
        System.out.println("------------------------------");
    }
}
